<script setup>
import { ref } from 'vue'
defineProps({
  msg: {
    type: String,
    required: true
  }
})

var test_text = 'test title'

var test_html = '<h2>test-html</h2>'

var test_style = ref('test-title')

var test_flag = ref(false)

//var test_style = 'test-title'

var item_list = ref(['item1','item2','item3'])

function test_func() {
  console.log('click')
  if (test_flag.value){
    test_style.value = 'test-title'
    console.log(test_flag.value)
    test_flag.value = false
  }else{
    test_style.value = 'test-title2'
    console.log(test_flag.value)
    test_flag.value = true
  }
  
  
}



</script>

<template>
  <div class="greetings">
    <h1 class="green">{{ msg }}</h1>
    <h1 v-bind:class="{'test-title' : test_flag}">{{ test_text }}</h1>
      <button @click="test_func">Click Me</button>
      <span v-if="test_flag">seen</span> 
      <li v-for="(item, index) in item_list">
      {{ item }}
    </li>
    <h3>
      You’ve successfully created a project with
      <a href="https://vite.dev/" target="_blank" rel="noopener">Vite</a> +
      <a href="https://vuejs.org/" target="_blank" rel="noopener">Vue 3</a>.
    </h3>
  </div>
</template>

<style scoped>
.test-title {
  color: #42b983;
}

.test-title2 {
  color: red;
}


h1 {
  font-weight: 500;
  font-size: 2.6rem;
  position: relative;
  top: -10px;
}

h3 {
  font-size: 1.2rem;
}

.greetings h1,
.greetings h3 {
  text-align: center;
}

@media (min-width: 1024px) {
  .greetings h1,
  .greetings h3 {
    text-align: left;
  }
}
</style>
